<?php
class CmsAdminLayout extends Layout
{
    protected $templateFile = 'CmsAdminLayout';

    public function GetConfig()
    {
       return CmsConfig::GetInstance();
    }

    public function Render($body)
    {
        $this->config->AddCss('admin');
        $menu = $this->GetMenu();

        $this->ReplaceElement('header');
        $this->ReplaceElement('footer');
        $this->Replace('menu', $menu->Render());
        return parent::Render($body);
    }

    protected function GetMenu()
    {
        return new MenuControl($this->config->MENU_ADMIN);
    }

    protected function AddCssJs()
    {
        parent::AddCssJs();
        BaseConfig::GetInstance()->AddCss('controls/resizer, controls/CalendarDateSelect');
        BaseConfig::GetInstance()->AddCss('controls/jquery.autocomplete');
        BaseConfig::GetInstance()->AddCss('upload/uploadify');
        GridConfig::GetInstance()->AddCss('GridControl');

        BaseConfig::GetInstance()->AddSharedJsNoPack('tiny_mce/tiny_mce');
        BaseConfig::GetInstance()->AddSharedJs('controls/DropdownControl, controls/resizer, controls/CalendarDateSelect, controls/DaterangeControl, controls/tooltip');
        BaseConfig::GetInstance()->AddSharedJs('jquery/jquery.autocomplete');
        BaseConfig::GetInstance()->AddSharedJs('upload/uploadify, upload/swfobject');
        GridConfig::GetInstance()->AddSharedJs('GridControl, GridSelectControl');

        CmsConfig::GetInstance()->AddSharedJs('CmsFormGroupControl');
        CmsConfig::GetInstance()->AddSharedJs('CmsFieldGroupControl');
        CmsConfig::GetInstance()->AddSharedJs('CmsPhotoListControl');
        CmsConfig::GetInstance()->AddSharedJs('CmsPhotoEditControl');
    }
}
?>